#include<bits/stdc++.h>
using namespace std;
const int N=2e6+5;
long long n,m,l,r;
vector<int>q[N];
int main()
{
	freopen("life.in","r",stdin);
	freopen("life.out","w",stdout);
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	cin>>n>>m;
	for(int i=1;i<n;++i)
		cin>>l>>r,q[l].push_back(r),q[r].push_back(l);
	cout<<"YES"<<'\n';
	cout<<m;
	return 0;
}
